<?php
require_once("../includes/Specialization.class.php");
?>

<form name="add_form" action="add_user_DB.php" method="post">
	<table>
		<tr>
			<td> ID : </td>
			<td> <input type="text" name="ID" /> </td>
			<td class="required last_check">  </td>
		</tr>
        
     <tr>
     	<td> name : </td>
     	<td><input type="text" name="name" /></td>
     	<td class="required last_check">  </td>
     </tr>    
       
     <tr>
     	<td> E-mail : </td>
     	<td><input type="text" name="email" /></td>
     	<td class="required last_check"> </td>
     </tr>
     
     <tr>
     	<td> Password : </td>
     	<td><input type="password" name="password" /></td>
     	<td class="required last_check"> </td>
     </tr>
      
     <tr>
       <td>Specialization: </td>
       <td>
        <select id = "specialization" name="specialization" onchange="subspecialization(this.options[this.selectedIndex].value)">
            <option value=""></option>
             <?php
              $Types = Specialization::find_all_ids();   
              for ( $i = 0 ; $i < count($Types) ; $i++ )
                {

                 echo "<option value =" . $Types[$i];
                 echo ">" . Specialization::find_type_name($Types[$i]) . "</option>";
                }
             ?>
        </select>
       </td>
       <td class = "required last_check"></td>
     </tr>

     <tr>
     	<td> phone_number: </td>
     	<td><input type = "text" name = "phone"/></td>
     	<td></td>
     </tr>
      
     <tr>
     	<td> home_address: </td>
     	<td><input type="text" name="home_address"></td>
     	<td></td>
     </tr>
       
     <tr>
     	<td> gender: </td>
     	<td><input type="radio" name="gender" value="M" checked/> Male
            <input type="radio" name="gender" value="F" /> Female
        </td>
     	<td> </td>
     </tr>
     
     <tr>
     	<td> user_type: </td>
     	<td><SELECT name="user_type" id="user_type" onchange="subspecialization(this.options[this.selectedIndex].value)">
            <OPTION value=""> </option>
            <OPTION value="doctor"> Doctor </option>
            <OPTION value="teacher"> Teacher </option>
            <OPTION value="student"> Student </option>
            </SELECT>
        </td>
     	<td class="required last_check" > </td>
     </tr>

    <tr id="level" class = "hidden">
       <td> Level : </td>
       <td>
         <select name="level">
            <option value=""></option>
            <option value="1">level 1</option>
            <option value="2">level 2</option>
            <option value="3">level 3</option>
            <option value="4">level 4</option>
         </select>
       </td>
       <td class="required last_check"></td>
    </tr>

    <tr id = "sub" class = "hidden">
       <td> SubSpecialization </td>
       <td>
          <select name="subSpecialization" id="subSpecializationSelect">
             <option value=""></option>
             <?php
              $Types=Specialization::find_all_ids();   
              for ( $i=0 ; $i < count($Types) ; $i++ )
               {
                 if($Types[$i] != 1)
                   {
                     echo "<option value=".$Types[$i];
                     echo " >" . Specialization::find_type_name($Types[$i]) . "</option>";
                   }
                }
             ?>
          </select>
        </td>
        <td class="required last_check"></td>
    </tr>

	 <tr>
        <td></td>
        <td></td>
        <td><input id="submit" type="button" value="Submit" onclick="validate_add_user_form()"></td>
     </tr>	
</table>
</form>